home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part2 / 15442 < prev    next >
Encoding:
Text File  |  1996-08-05  |  1.8 KB  |  51 lines

  1. Newsgroups: comp.os.ms-windows.programmer.win32,comp.lang.c++
  2. Path: in2.uu.net!world!mv!usenet
  3. From: ENGR@GSSI.MV.COM (Michael Furman)
  4. Subject: Re: BUG REPORT: Microsoft Visual C++ 4.1
  5. Message-ID: <DpE7CB.26v@mv.mv.com>
  6. Mime-Version: 1.0
  7. Content-Type: Text/Plain; charset=US-ASCII
  8. Organization: GSSI
  9. Date: Fri, 5 Apr 1996 14:09:47 GMT
  10. References: <316445a3.428887193@news.primenet.com>
  11. X-Newsreader: WinVN 0.99.7
  12. X-Nntp-Posting-Host: gssi.mv.com
  13.  
  14. In article <316445a3.428887193@news.primenet.com>, gbe@primenet.com 
  15. says...
  16. >
  17. >/* BugDemo.cpp
  18. >
  19. >   Here is a demonstration of a serious bug that I just found in 
  20. Microsoft
  21. >   Visual C++ Version 4.1. 
  22.  
  23. Debugging version of MS C/C++ compilerss of all versions have bugs - 
  24. I find them each time when I forget to set options for using optimizing
  25. version. Last time it happend yesterday on the following code fragment
  26. (r defined as "long", bcode as "unsigned char []", compiler version is
  27. 1.52):
  28.  
  29.   // Next statement must be compiled with enabled optimizations
  30.   // because of bug in MSVC 1.52 C++ compiler  
  31.   if((r & 0xFF) != bcode[7] || ((r >> 8) & 0xFF) != bcode[6] ||
  32.      ((r >> 16)  & 0xFF) != bcode[5])
  33.     return -1; 
  34.  
  35. Address of bcode[7] was calculated incorrectly - actually it used
  36. bcode[5] instead.
  37.  
  38. My practice to avoid that is to use only optimizing version of compiler
  39. (even in case of all disabled optimizations).
  40.  
  41. -- 
  42. <<< If you received it by E-mail: it is a copy of post to the newsgroup 
  43. >>>
  44. ---------------------------------------------------------------
  45. Michael Furman,                       (603)893-1109
  46. Geophysical Survey Systems, Inc.  fax:(603)889-3984
  47. 13 Klein Drive - P.O. Box 97          engr@gssi.mv.com 
  48. North Salem, NH 03073-0097            71543.1334@compuserve.com
  49. ---------------------------------------------------------------
  50.  
  51.